package org.dey.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.dey.pojo.HealthAssessment;
import org.dey.pojo.Member;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface HealthAssessmentMapper extends BaseMapper<HealthAssessment> {

    @Delete("delete FROM t_mental_health_assessment where haid = #{id}")
    void deleteByHaid(Integer id);

    @Select("SELECT ha.* FROM `t_mental_health_assessment` ha INNER JOIN `t_member` tm ON ha.`file_number`=tm.`file_number`")
    List<HealthAssessment> queryHa();


    @Select("SELECT t.id,tm.`name`,t.member_id FROM t_order t INNER JOIN t_member tm  ON tm.`id`=t.member_id WHERE t.orderStatus='已确定' and t.orderDate=#{date} ")
     List<Member> queryTroid(Date date);

}
